﻿using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BusinessLogic
{
    public class Login
    {
        public static bool LoginUser(string userName,string userPwd)
        {
            if (DataAccess.Login.LoginUser(userName, userPwd))
            {
                MessageBox.Show("Logined Succeed !");
                return true;
            }
            else
            {
                MessageBox.Show("UserName or Password is error , please put again.");
                return false;
            }
                
        }

        public static int Registered(string username,string userpwd,string userphone)
        {
            if (DataAccess.Login.IsUserExist(username))
            {
                MessageBox.Show("Manager already exists!");
                return 0;
            }
            DataAccess.Login _login = new DataAccess.Login();
            _login.UserName = username;
            _login.UserPwd = userpwd;
            _login.UserPhone = userphone;
            int result = DataAccess.Login.Registered(_login);
            return result;
        }

    }
}
